{% extends "base_portadmin.html" %}

{% block object-tools %}
	<ul class="object-tools">
		<li><a href="/portadmin/csts/" class="historylink">List of CST</a></li>
	</ul>
{% endblock %}

{% block content %}

	<form action="." method="post">
	{% csrf_token %}
	<table>
		{% for f in form %}
			<tr>
				<th>{{ f.label }}</th>
				<td>
					{{ f.errors }}
					{% if f.name == "market_direction_1" %}
						<select name="{{ f.name }}">
							<option value="">----</option>
							{% for cst in free_csts_1.values %}
								{% if cst.parameter_pk == f.value %}
									<option value="{{ cst.parameter_pk }}" selected>{{ cst.name }} </option>
								{% else %}
									<option value="{{ cst.parameter_pk }}" {{ cst.disabled }}>{{ cst.name }} </option>
								{% endif %}
							{% endfor %}
						</select>
					{% else %}
						{% if f.name == "market_direction_2" %}
							<select name="{{ f.name }}">
								<option value="">----</option>
								{% for cst in free_csts_2.values %}
									{% if cst.parameter_pk == f.value %}
										<option value="{{ cst.parameter_pk }}" selected>{{ cst.name }} </option>
									{% else %}
										<option value="{{ cst.parameter_pk }}" {{ cst.disabled }}>{{ cst.name }} </option>
									{% endif %}
								{% endfor %}
							</select>
						{% else %}
							{{ f }}
						{% endif %}
					{% endif %}
				</td>
		{% endfor %}
	</table>
	<input type="submit" class="default" value="Save" />
	<input type="button" onclick="document.location.href='/portadmin/csts/'; return false;" value="List of CST" />
	</form>

{% endblock %}